package com.neusoft.edu.hystrix;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.neusoft.edu.sys.AjaxResult;
/**
 * 全局熔断器
 * @author Zhang.Yan
 *
 */
@RestController
public class HystrixFilter extends AjaxResult
{
	private static final Logger logger = LoggerFactory.getLogger(HystrixFilter.class);
	                            
	@HystrixCommand(commandKey="globalHystrixCommand")
	public Object doHystrixCommand()
	{
		String info="全局熔断器Command";
		logger.info(info);
		return super.ajaxResultFailure(info);
	}
	
	
	@RequestMapping("/globalHystrixUrl")
	public Object doHystrixUrl()
	{
		String info="全局熔断器URL";
		logger.info(info);
		return super.ajaxResultFailure(info);
	}
	
	@HystrixCommand(commandKey="teaHystrixCommand")
	public Object doTeaHystrixCommand()
	{
		String info="TEA熔断器Command";
		logger.info(info);
		return super.ajaxResultFailure(info);
	}
	
	
	@RequestMapping("/teaHystrixUrl")
	public Object doTeaHystrixUrl()
	{
		String info="TEA熔断器URL";
		logger.info(info);
		return super.ajaxResultFailure(info);
	}
}
